package com.question.business.dict.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.question.business.dict.entity.Dict;
import com.question.business.dict.model.vo.DictDetailVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 字典Mapper接口
 *
 * @author star
 * @since 2023-09-07
 */
@Mapper
public interface DictMapper extends BaseMapper<Dict> {
    /**
     * 字典分页查询
     *
     * @param typeId 类型ID
     * @return List<DictDetailVO> 响应参数
     */
    @Select("SELECT * FROM t_dict WHERE  type_id = #{ao.typeId} ORDER BY dict_order ASC")
    List<DictDetailVO> queryDictList(String typeId);

    /**
     * 根据字典类型删除字典明细
     *
     * @param typeId 字典类型
     */
    @Delete("DELETE FROM t_dict WHERE type_id = #{typeId}")
    void deleteByTypeId(String typeId);
}